/**
 * 存储 session storage
 */
export default class Ls {
  /**
   * 获取
   */
  get(key) {
    return new Promise(resolve => {
      const value = sessionStorage.getItem(key)
      if (value) {
        resolve(value)
      } else {
        resolve(false)
      }
    })
  }

  /**
   * 存储
   */
  set(key, value) {
    return new Promise(resolve => {
      sessionStorage.setItem(key, value)
      if (sessionStorage.getItem(key)) {
        resolve(sessionStorage.getItem(key))
      } else {
        resolve(false)
      }
    })
  }
}
